package com.boge.parse.amf;

import java.nio.charset.Charset;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;


/**
 * AMF 过滤器
 * @author Administrator
 *
 */
public class AmfProtocolCodecFilter implements ProtocolCodecFactory {

	private AmfProtocolDecoder amfProtocolDecoder;
	private AmfProtocolEncoder amfProtocolEncoder;
	
	public AmfProtocolCodecFilter() {
		this(Charset.defaultCharset());  
	}
	
    public AmfProtocolCodecFilter(Charset charset) {  
        amfProtocolDecoder = new AmfProtocolDecoder(charset);
        amfProtocolEncoder = new AmfProtocolEncoder();
    } 
    
	@Override
	public ProtocolDecoder getDecoder(IoSession session) throws Exception {
		return amfProtocolDecoder;
	}

	@Override
	public ProtocolEncoder getEncoder(IoSession session) throws Exception {
		return amfProtocolEncoder;
	}

}
